package com.powernode.proxy.client;

import com.powernode.proxy.service.TimerMethodInterceptor;
import com.powernode.proxy.service.UserService;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;

public class Client {
    public static void main(String[] args) {
        Enhancer enhancer=new Enhancer();
        enhancer.setSuperclass(UserService.class);
        enhancer.setCallback(new TimerMethodInterceptor());
        UserService userServiceProxy=(UserService) enhancer.create();
        boolean success = userServiceProxy.login("admin", "123");
        System.out.println(success?"登陆成功":"登陆失败");
        userServiceProxy.logout();
    }
}
